package main

import (
	"fmt"
	"sync"
	"time"
)

type Person struct {
	Name  string
	Alive bool
}

func Kill(person *Person) {
	fmt.Println("杀死:", person)
	time.After(time.Second * 3)
	person.Alive = false

	fmt.Println("AAAAAA")
}
func main() {
	var once sync.Once
	var wg sync.WaitGroup
	bill := &Person{"胡冉", true}
	for i := 0; i < 10; i++ {
		wg.Add(1)
		go func() {
			once.Do(func() {
				Kill(bill)
			})
			wg.Done()
		}()
	}

	wg.Wait()

	fmt.Println("over")
}
